package cn.com.ddapp.ddm.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.com.ddapp.ddm.R;
import cn.com.ddapp.ddm.widget.GridViewForListView;


public class SlidingBigAdpter extends BaseAdapter {
    private Context mContext;
    private List<String> mLists ;
    private LayoutInflater layoutInflater;

    public SlidingBigAdpter(Context context, List<String> lists) {
        mContext = context;
        mLists = lists;
        layoutInflater=LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return mLists != null ? mLists.size():0;
    }

    @Override
    public Object getItem(int i) {
        return mLists.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    public void addView(List<String> ll){
        if(ll.size()<=0){
            return;
        }else{
            mLists.addAll(ll);
        }
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        ViewHolder holder=null;
        if(convertView == null){
            convertView= layoutInflater.inflate(R.layout.sliding_name,null);
            holder=new ViewHolder(convertView);
            convertView.setTag(holder);
            AutoUtils.auto(convertView);
        }else{
            holder= (ViewHolder) convertView.getTag();
        }

//        NearStoreBean.ShopBean bean=mLists.get(position);
        holder.slidingbig_name.setText(mLists.get(position));

//        SlidingSmallAdpter smallAdpter=

        return convertView;
    }


    static class ViewHolder{
        @BindView(R.id.slidingbig_name)
        TextView slidingbig_name;
        @BindView(R.id.slidingsmall_view)
        GridViewForListView slidingsmall_view;


        public ViewHolder(View view){
            ButterKnife.bind(this,view);
        }
    }
}
